package e.odbo.data.dao.interceptor;

import e.odbo.data.bean.CreateDateAble;
import e.odbo.data.bean.I_BaseBean;

import java.util.Date;

public class CreateDateInterceptor extends AbstractDAOInterceptor{

    @Override
    public boolean beforeInsert(I_BaseBean obj) {
        ((CreateDateAble)obj).setCreateDate(new Date());
        return super.beforeInsert(obj);
    }


    @Override
    public boolean interceptorAble(Class beanClass) {
        return CreateDateAble.class.isAssignableFrom(beanClass);
    }
}
